<?php

class Show extends TPage
{
	private $element_manager;
	private $element;
	
	public function onLoad($param)
	{
		parent::onLoad($param);
		$this->element_manager = $this->Application->Modules['requested_elements'];
		
		$this->element = $this->element_manager->getRequestedElementById($this->Request['id']);
		if(!($this->element instanceof RequestedElementRecord))
			$this->Response->redirect($this->Service->constructUrl('committee.requested_elements.All'));
			
		if(!$this->IsPostback)
		{
			$this->readData();
		}
	}
	
	public function readData()
	{
		$this->name->Text = $this->element->getName();
		$this->description->Text = $this->element->getDescription() !== null ? $this->element->getDescription() : '';
		$this->status->Text = $this->element->getStatus();

		
		$user_manager = $this->Application->Modules['users'];
		$user = $user_manager->getUserById($this->element->getOwnerId());
		$this->owner->Text = $user !== null ?$user->getFullName() : '-';
		
		
		$element_manager = $this->Application->Modules['conference_elements'];
		$conference_element = $element_manager->getConferenceElementById($this->element->getSessionId());
		$this->session->Text = $conference_element != null ?
									$conference_element->getName().'<br/>'.$conference_element->getDescription() :
									'-';
	}
}

?>